package edu.lyun.studenttest.service.impl;

import edu.lyun.studenttest.entity.Student;
import edu.lyun.studenttest.mapper.StudentMapper;
import edu.lyun.studenttest.service.StudentService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Resource
    StudentMapper studentMapper;

    @Override
    public List<Student> getStudents() {
        return studentMapper.getStudents();
    }

    @Override
    @Transactional
    public int deleteStudentById(int id) {
        return studentMapper.deleteStudentById(id);
    }

    @Override
    @Transactional
    public int appendStudent(Student student) {
        return studentMapper.appendStudent(student);
    }

    @Override
    @Transactional
    public int updateStudent(Student student) {
        return studentMapper.updateStudent(student);
    }

}
